﻿using System.ComponentModel.DataAnnotations;
using DiNinject.Repository.Interfaces;
using DiNinject.Web.UI.Models.Autos.ModelInterfaces;
using Ninject;

namespace DiNinject.Web.UI.Models.Autos
{
    public class AutoViewModel : IAutoViewModel
    {
        #region Member
        public bool IsLuxusMarke { get; set; }

        public int Id { get; set; }

        public string Marke { get; set; }

        public string Nummernschild { get; set; }
        #endregion

        #region Public Functions
        /// <summary>
        /// Laden der Anzeige für ein Auto
        /// </summary>
        public void Load(int id, IAutoRespository autoRespository)
        {
            var dBModel = autoRespository.Load(id);
            IsLuxusMarke = dBModel.Marke == "BMW";
            Marke = dBModel.Marke;
            Nummernschild = dBModel.Nummernschild;
            Id = dBModel.Id;
        }
        #endregion
    }
}